package base.day26.tcp;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ReceptionDemo2 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss=new ServerSocket(10006);
        Socket accept = ss.accept();
        InputStream is = accept.getInputStream();
        int c;
        while ((c=is.read())!=-1){
            System.out.println("----");
            System.out.println((char) c);
        }

        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("返回");
        bw.newLine();
        bw.flush();

        is.close();
        bw.close();
        accept.close();
        ss.close();
    }

}
